/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ec.imsx.control;

/**
 *
 * @author miguesaca
 */
import ec.imsx.modelo.Producto;
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
 
@ManagedBean
@ViewScoped
public class ProductoController implements Serializable {
     
    private List<Producto> cars;
     
    private Producto selectedCar;
     
    @ManagedProperty("ec.imsx.control.carService")
    private ProductoService service;
     
    @PostConstruct
    public void init() {
        cars = service.createCars(9);
        System.out.println("Inicializacion: "+cars);
    }
 
    public List<Producto> getCars() {
        return cars;
    }
 
    public void setService(ProductoService service) {
        this.service = service;
    }
 
    public Producto getSelectedCar() {
        return selectedCar;
    }
 
    public void setSelectedCar(Producto selectedCar) {
        this.selectedCar = selectedCar;
    }
}
